 const webpack = require('webpack');
 const merge = require('webpack-merge');
 const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
 const common = require('./webpack.common.js');
 const OptimizeCSSAssetsPlugin = require("optimize-css-assets-webpack-plugin");
 const MiniCssExtractPlugin = require("mini-css-extract-plugin");//提取css到单独文件的插件

     module.exports = merge(common, {
       mode: 'production',
      /* devtool: 'source-map',*/
         // module: {
         //     rules: [
         //         {
         //             test: /\.css$/,
         //             use: [
         //                 MiniCssExtractPlugin.loader,//注意这边
         //                 "css-loader"
         //             ]
         //         }
         //     ]
         // },
       plugins: [
/*            new UglifyJSPlugin({
                sourceMap: true
            }),
            new webpack.DefinePlugin({
                'process.env.NODE_ENV': JSON.stringify('production')
            }),*/
            new webpack.HashedModuleIdsPlugin(),
            // new OptimizeCSSAssetsPlugin({
            //
            //     cssProcessor: require('cssnano'), //引入cssnano配置压缩选项
            //     cssProcessorOptions: {
            //         discardComments: { removeAll: true }
            //     },
            //     canPrint: true
            // })
           // new MiniCssExtractPlugin({
           //     filename: "css/[name].css",////都提到build目录下的css目录中
           //     chunkFilename: "[id].css"
           // }),
           new OptimizeCSSAssetsPlugin()
 ]
 });